package com.sakura.mybatisplus.generator.controller;


import com.sakura.mybatisplus.generator.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sakura
 * @since 2021-08-10
 */
@Controller
@RequestMapping("/generator/user")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/test")
    public ModelAndView test(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("test");
        //这里Service也帮我们封装好了
        modelAndView.addObject("list", userService.list());
        return modelAndView;
    }

}

